package com.gpStudy.Netty.IO.BIO.tomcat.http;

import java.io.OutputStream;

public class GPResponse {

    private OutputStream out;

    public GPResponse(OutputStream out) {
        this.out = out;
    }

    public void write(String content) throws Exception{

        // 遵循 HTTP 协议，补充协议相关信息
        StringBuilder sb = new StringBuilder();
        sb.append("HTTP/1.1 200 OK\n")
                .append("Content-Type: text/html;\n")
                .append("\r\n")
                .append(content);

        out.write(sb.toString().getBytes());
    }
}
